<?php
class TemplatesController extends AppController 
{

    public $sN = 'Template'; 
    public $pN = 'template';
    public $lN = 'templates';    

    public function beforeFilter() {
        parent::beforeFilter();
        $this->set('sN', $this->sN);        
        $this->set('pN', $this->pN);
        $this->set('lN', $this->lN);      
    }

    public function admin_index() {
        $values = $this->paginate($this->sN);
      	$this->set('values', $values);

    }
    
    public function admin_edit($id = null) {

        if(empty($this->data)) {
            $this->request->data = $this->Template->read(null, $id);
        }else{
            $this->Template->id = $id;
            if($this->Template->save($this->data)) {
                $this->Session->setFlash(__('Updated Successfully', true));
                $this->redirect(array('controller' => 'templates', 'action' => 'index', 'admin' => true));
            }
        }
    }
    
}